<div class="btn-group" style="width: auto; height: 60px;"> 
    <a class="btn btn-info" title="Generar" id="doreporte">
        <span class="icon-search icon-white"></span>
        Generar</a>
    <?php
    foreach ($this->printers as $k => $v) {
        ?>
        <a alt="printer" class="btn btn-info" title="<?php echo $v["label"]; ?>" 
           href="javascript:;" onclick="javascript:doCall('<?php echo "main.php?name=" . $this->defaultReport->key . "&params=true&print=true&printer=" . $v["name"]; ?>')">
               <?php echo $v['label']; ?>             
            <span class="icon-download-alt icon-white"></span>
        </a>
        <?php
    }
    ?> 
    <a alt="printer" class="btn btn-info" title="Imprimir" href="javascript:;" id="doprint" >
        <span class="icon-print icon-white" ></span>
        Imprimir    
    </a>
    <a class="btn btn-info" title="Regresar" href="main.php?name=<?php echo $this->defaultReport->key; ?>" >
        <span class="icon-remove-circle icon-white" ></span> 
        Limpiar
    </a>
</div>
<script type="text/javascript">
               var fPrinters = function() {
                   $("a").each(function() {
                       if ($(this).attr("alt") === "printer") {
                           $(this).hide();
                       }
                   });
               }
               fPrinters();
               $("#doreporte").click(function() {
                   doReportReq();
               });
               $("#doprint").click(function() {
                   app.toPrinter(fPrinters);
               });
               var pleaseWaitDiv = $('<div class="modal hide" id="pleaseWaitDialog" data-backdrop="static" data-keyboard="false"><div class="modal-header"><h1>Generando Reporte...</h1></div><div class="modal-body"><div class="progress progress-striped active"><div class="bar" style="width: 100%;"></div></div></div></div>');
               var thereIsResult = false;
               var $beforeDialog = {
                   show: function() {
                       pleaseWaitDiv.modal();
                   },
                   hide: function() {
                       pleaseWaitDiv.modal('hide');
                   }};
               var doReportReq = function() {
                   //trae informacion del estado de cuenta
                   app.doAppAjax(
                           {
                               type: "POST",
                               data: $("#reportform").serialize(),
                               url: "main.php?name=<?php echo $this->defaultReport->key ?>&params=true",
                               success: function(data) {
                                   $("#resultado").html(data);
                                   thereIsResult = true;
                                   $("a").each(function() {
                                       if ($(this).attr("alt") === "printer") {
                                           $(this).show();
                                       }
                                   });
                                   $beforeDialog.hide();
                               },
                               beforeSend: function() {
                                   $beforeDialog.show();
                               },
                               error: function() {
                                   alert("Error al cargar el reporte");
                                   ;
                               }});
               };
               var doCall = function(url) {
                   $(document.forms[0]).attr("action", url);
                   $(document.forms[0]).submit();
               };
</script>